import service from '@/utils/request'

const url = {
  // 新增研究成果
  addResearch: '/research/add',
  // 认领研究成果
  claimResearch: '/research/claim',
  // RIS文件解析
  risAnalysis: '/research/ris',
  // 获取用户研究成果列表
  getResearchList: '/research/list',
  // 获取当前用户潜在研究成果列表
  getClaimList: '/research/claimlist',
  // 请求文件
  askFile: '/research/askfile',
  // 添加文件
  addFile: '/research/addfile',
  likeResearch: '/research/like',
  getResearch: '/research/detail'
}

export const Research = {
  // 新增研究成果
  addResearch: function (params) {
    return service({
      url: url.addResearch,
      method: 'post',
      data: params
    })
  },
  // 认领研究成果
  claimResearch: function (params) {
    return service({
      url: url.claimResearch,
      method: 'post',
      data: params
    })
  },
  // RIS文件解析
  risAnalysis: function (params) {
    return service({
      url: url.risAnalysis,
      method: 'post',
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      data: params
    })
  },
  // 获取用户研究成果列表
  getResearchList: function (params) {
    return service({
      url: url.getResearchList,
      method: 'get',
      params: params
    })
  },
  // 获取当前用户潜在研究成果列表
  getClaimList: function (params) {
    return service({
      url: url.getClaimList,
      method: 'get',
      params: params
    })
  },
  // 请求文件
  askFile: function (params) {
    return service({
      url: url.askFile,
      method: 'post',
      data: params
    })
  },
  // 添加文件
  addFile: function (params) {
    return service({
      url: url.addFile,
      method: 'post',
      data: params
    })
  },
  likeResearch: function (data) {
    return service({
      url: url.likeResearch,
      method: 'post',
      data
    })
  },
  getResearch: function (data) {
    return service({
      url: url.getResearch,
      method: 'post',
      data
    })
  }
}
